package jym.tan.tmdb.method.get;

import java.net.URL;

import jym.tan.tmdb.TMDB;
import jym.tan.tmdb.bean.wrapper.MovieAlternativeTitleWrapper;
import jym.tan.tmdb.constant.TMDBConstants;
import jym.tan.tmdb.method.Base;

/**
 * The Class MovieAlternativeTitles. This class is similar to the <b>Movie Alternative Titles</b> method described in 
 * <a href="http://help.themoviedb.org/kb/api/movie-alternative-titles">Movie Alternative Titles</a>.
 * This method is used to retrieve all of the alternative titles we have for a particular movie.
 * 
 * @author Tanmoy
 */
public class MovieAlternativeTitles extends Base {

	/**
	 * Instantiates a new MovieAlternativeTitles.
	 *
	 * @param tmdb 
	 * 		An instance of the {@link TMDB} class
	 */
	public MovieAlternativeTitles(TMDB tmdb) {
		super(tmdb, TMDBConstants.MOVIE, TMDBConstants.ALTERNATIVE_TITLES);
	}
	
	/**
	 * Gets a {@link MovieAlternativeTitleWrapper} object.
	 *
	 * @param movieId 
	 * 		The TMDB id / the IMDB id
	 * @param country 
	 * 		The country parameter will filter the results to only include titles in that 
	 * 		particular country. Remember, if a translation exists, it might not have an 
	 * 		entry here. The expected value is a ISO 3166-1 code
	 * @return 
	 * 		The <code>AlternativeTitleWrapper</code> object
	 * @throws Exception 
	 * 		If any kind off exception occurred
	 */
	public MovieAlternativeTitleWrapper getAlternativeTitleWrapper(String movieId, String country) throws Exception {
		URL alternativeTitleURL = getUrl(movieId, TMDBConstants.BLANK, country);
		MovieAlternativeTitleWrapper alternativeTitleWrapper = getJsonObject(alternativeTitleURL, MovieAlternativeTitleWrapper.class);
		return alternativeTitleWrapper;		
	}
}
